#!/usr/bin/env bash

PN=$(cat ./pluginname)

docker plugin disable -f ${PN}
docker plugin rm -f ${PN}

service docker stop
service docker start

### plugin's build directory, use /tmp to avoid pitfalls with VM mountss
#PBD=/tmp/trident/build
PBD=.

sudo cp -f ../../../trident .
sudo cp -f ./trident ${PBD}/myplugin/rootfs/netapp/trident
sudo cp -f ./plugin.json ${PBD}/myplugin/config.json

sudo docker plugin create ${PN} ${PBD}/myplugin
./pushPlugin
sudo docker plugin rm $PN
sudo docker plugin install --grant-all-permissions ${PN} debug=true
